<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</meta>
<title>F.proxy</title>
<link type="text/css" rel="stylesheet" href="../css/admin.css" />
<link type="text/css" rel="stylesheet" href="../css/item_show.css" />
<script type="text/javascript" src="../../1st.js"></script>
<script type="text/javascript" src="../../1st.highlight.js"></script>
</head>
<body id="split">
<div id="content">
	<div rel="F.param">
		<h2><span>返回值:</span>F.proxy</h2>
					<h3>概述 : 作用域绑定代理</h3>
						
			<div class="desc">
				<div class="longdesc"><pre>返回一个指定作用域的函数
如果有更多参数，则把多余的参数传给返回的函数

语法二中，当fun=函数名时，必须是第一个作用域对象的一个属性


var o = {
	a : function(){
		this.c = 111;
		F.ajax(url, F.proxy(this,this.b, 8));
	},
	b : function(x){
		alert(x);	
	}
}
1.F.proxy(fun,scope) => fun.proxy(scope);
2.F.proxy(scope,fun);
3.F.proxy(scope,funName);

原型写法：functionObj.proxy(This,[more])</pre></div>
			</div>
							<h3>语法1：F.proxy(functionObj, scope, [more])</h3>
						<table class="args">
				<!--caption>参数列表：(3)</caption-->
				<tr><th>参数名称</th><th>类型</th><th>描述</th></tr>
									<tr><td><strong>functionObj</strong></td><td>Function</td><td>函数对象,可作为函数原型调用</td></tr>
									<tr><td><strong>scope</strong></td><td>Object</td><td>作用域对象</td></tr>
									<tr><td><strong>more</strong><em> (可选)</em></td><td>Variable</td><td>更多参数</td></tr>
								<tr><td colspan="3">&nbsp;</td></tr>
				<tr><td>返回值</td><td>Function</td><td></td></tr>
			</table>
					<h3>语法2：F.proxy(scope, fun, [more])</h3>
						<table class="args">
				<!--caption>参数列表：(3)</caption-->
				<tr><th>参数名称</th><th>类型</th><th>描述</th></tr>
									<tr><td><strong>scope</strong></td><td>Object</td><td>作用域对象</td></tr>
									<tr><td><strong>fun</strong></td><td>Function,String</td><td>函数对象或函数名</td></tr>
									<tr><td><strong>more</strong><em> (可选)</em></td><td>Variable</td><td>更多参数</td></tr>
								<tr><td colspan="3">&nbsp;</td></tr>
				<tr><td>返回值</td><td>Function</td><td></td></tr>
			</table>
				<div class="example">
			<h3>示例 : </h3>
						
									
				<h5 xmlns="">JS代码:</h5>
				<pre xmlns=""><code id="jsbox"></code></pre>
										
				<h5 xmlns="">结果:</h5>
				<pre xmlns=""><code id="resultbox"></code><code></code></pre>
					</div>
		<div style="text-align:right">
			
					
				<button onclick="window.open('../codepages/70.html');">运行代码</button>
						
		</div><br/>	
		<div>
			<h3>同类参考 :</h3>
			<div>
							<span><a href='71.html'>F.inherit</a></span>						</div>
		</div>
	</div>
</div><br />

<textarea id="css" style="display:none;"></textarea>
<textarea id="html" style="display:none;"></textarea>
<textarea id="js" style="display:none;">var o = {
	init : function(base){
		this.base = base;
		window.setTimeout(this.play.proxy(this,12), 300);
	},
	play : function(num){
		alert(this.base*num);
	}
};
o.init(30);</textarea>
<textarea id="result" style="display:none;">360</textarea>


<script type="text/javascript">
var css = F('css').val();
var html = F('html').val();		
var js = F('js').val();
var result = F('result').val();
css && F('cssbox').highlight(css, "css");
html && F('htmlbox').highlight(html, "html");
js && F('jsbox').highlight(js, "js");
result && F('resultbox').highlight(result,"js");
</script>

</body>
</html>